import os

# 因为用的wsl2，此子系统是nat模式链接的主机，所以得通过这个ip号来进行通信
# 因为dns服务所以每次重启电脑都会更新，故用此方式
# with open("/etc/resolv.conf", "r", encoding="utf8") as f:
#    window_host = f.read().split(" ")[-1].replace("\n", "")

# 服务器用的host
window_host = "47.97.66.178"

# 配置secret_key，，随机输出
SECRET_KEY = os.urandom(24)

# 数据库配置
HOSTNAME = window_host
PORT = "3306"
DATABASE = "reward"
USERNAME = "root"
PASSWORD = "dn19980926"
DB_URI = "mysql+pymysql://{}:{}@{}:{}/{}?charset=utf8".format(USERNAME,PASSWORD,HOSTNAME,PORT,DATABASE)
# 构造sql连接
SQLALCHEMY_DATABASE_URI = DB_URI
# 去除警告
SQLALCHEMY_TRACK_MODIFICATIONS = True

# redis配置
REDIS_DB_URL = {
        'host': window_host,
        'port': 6379,
        # 'password': 'inetlabredis',
        'db': 3,
        "decode_responses": True
    }


DEBUG = True

# 邮箱配置,现在使用的qq邮箱
MAIL_SERVER = "smtp.qq.com"
MAIL_PORT = 465
MAIL_USE_TLS = False
MAIL_USE_SSL = True
MAIL_DEBUG = True
MAIL_USERNAME = "871201602@qq.com"
MAIL_PASSWORD = "frtheajuhlwfbcbg"
MAIL_DEFAULT_SENDER = "871201602@qq.com"

